package com.cheng.im.gateway.protobuilder;

import com.cheng.im.common.bean.msg.ProtoMsg;
import com.cheng.im.common.bean.msg.ProtoMsgV1;

public class NotificationMsgBuilder
{

    public static ProtoMsgV1.Message buildNotification(String json)
    {
        ProtoMsgV1.Message.Builder mb = ProtoMsgV1.Message.newBuilder()
                .setType(ProtoMsgV1.HeadType.MESSAGE_NOTIFICATION);   //设置消息类型


        //设置应答流水，与请求对应
        ProtoMsgV1.MessageNotification.Builder rb =
                ProtoMsgV1.MessageNotification.newBuilder()
                        .setExtra(json);
        mb.setNotification(rb.build());
        return mb.build();
    }

    public static ProtoMsgV1.Message buildNotification(String json, String sessionId, String appId)
    {
        ProtoMsgV1.Message.Builder mb = ProtoMsgV1.Message.newBuilder()
                .setType(ProtoMsgV1.HeadType.MESSAGE_NOTIFICATION)
                .setSessionId(sessionId)
                .setAppId(appId);   //设置消息类型


        //设置应答流水，与请求对应
        ProtoMsgV1.MessageNotification.Builder rb =
                ProtoMsgV1.MessageNotification.newBuilder()
                        .setExtra(json);
        mb.setNotification(rb.build());
        return mb.build();
    }


}
